﻿@model IEnumerable<KRM.Core.vKRMPartSSAdmin>
@{
    var view = ViewBag.CanView;
}
@Html.Partial("Partial/_MessageResult")
<div class="border-padding10 ">
    <table class="table table-bordered table-fix krmtable tbl-selected tbspreadsheet" data-height="200">
        <thead class="theadspreadsheet">
            <tr>
                <th>PartID</th>
                <th>PartName</th>
                <th>GroupName</th>
                <th>CompanyName</th>
                <th>Is Stock</th>
                <th>StockLevel</th>
                <th>WeightKG</th>
                <th>SupplierCode</th>
                <th>Packages</th>
                <th>CarrierServiceName</th>
                <th>SupplierLeadtime</th>
                @if (view)
                {
                    <th>NormalTrade</th>
                    <th>TradePrice</th>
                    <th>CarriageCharge</th>
                    <th>OurtradeIncCarriage</th>
                    <th>RetailExcVAT</th>
                    <th>OurRetailPrice</th>
                    <th>MarginPound</th>
                    <th>MarginPercent</th>
                }
                <th>Created</th>
                <th>CreatedByUserID</th>
                <th>Updated</th>
                <th>UpdatedByUserID</th>
                <th>PartDeleted</th>
                <th>IsOnSite</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                var color = item.IsOnSite == true ? "Green" : "Red";
                <tr onclick="spreadsheetselected('@item.PartID','@item.PartName.Replace("'", "\"")')">
                    <td>@item.PartID</td>
                    <td style="color: @color">@item.PartName</td>
                    <td>@item.GroupName</td>
                    <td>@item.CompanyName</td>
                    <td>@item.IsStocked</td>
                    <td>@item.StockLevel</td>
                    <td>@item.weightKG</td>
                    <td>@item.SupplierCode</td>
                    <td>@item.packages</td>
                    <td>@item.Carrier_Service_Name</td>
                    <td>@item.SupplierLeadtime</td>
                    @if (view)
                    {
                        <td>@item.NormalTrade</td>
                        <td>@item.TradePrice</td>
                        <td>@item.CarriageCharge</td>
                        <td>@item.OurTradeIncCarriage</td>
                        <td>@item.RetailExcVAT</td>
                        <td>@item.OurRetailPrice</td>
                        <td>@item.MarginPound</td>
                        <td>@item.MarginPercent</td>
                    }
                    <td>@item.Created</td>
                    <td>@item.CreatedByUserID</td>
                    <td>@item.Updated</td>
                    <td>@item.UpdatedByUserID</td>
                    <td>@item.PartDeleted</td>
                    <td>@item.IsOnSite</td>
                </tr>
            }
        </tbody>
    </table>
</div>
